home *** CD-ROM | disk | FTP | other *** search
/ ETO Development Tools 1 / ETO Development Tools 1.iso / Essentials / MacApp Documentation / MacApp AppleLink Messages / MacApp.Tech$ 3⁄30⁄90 / 1014-Re RE(2) FindObject(-Mar90 < prev    next >
Encoding:
Text File  |  1990-03-30  |  2.2 KB  |  58 lines  |  [TEXT/GEOL]

  1. Item    9970676                         30-March-90        15:22PST
  2.  
  3. From:   POWERUP.ENG                     Power Up Software,PRT
  4.  
  5. To:     MACAPP.TECH$                    MacApp Technical
  6.         MADA2                           MacApp Dev Assoc, Curtis Faith,IVC
  7.  
  8. Sub:    RE>RE(2) FindObject() and
  9.  
  10. Attn:   MacApp.Tech$
  11. Attn: MacApp Dev Assoc, Curtis Faith
  12. SentBy: James Plamondon
  13. Date   3/30/90
  14. Subject    RE>RE(2) FindObject() and F
  15. From   James Plamondon
  16. To MacApp Dev Assoc, Curtis Faith
  17. CC   MacApp.Tech$
  18.  
  19. Reply to:  RE>RE(2) FindObject() and Find
  20. Dear Curtis,
  21.  
  22. Thank you for your cogent response to my recent link regarding TSortedList.  I
  23. have a few comments in response.
  24.  
  25. You mention that "FindValue also limits a particular object to having only one
  26. search criterion unless one bypasses it and uses Search directly."
  27.  
  28. This is entirely correct.  FindValue() useful only in such cases. But I think
  29. that this is an exceptionally common case, and one which therefore should be
  30. dealt with in a TSortedList method.
  31.  
  32. Then you ask why I could not "simply subclass TSortedList and provide a new
  33. method TMySortedList.FindSomeObjectThatIWant that uses the particular TestItem
  34. mentioned above.  You would use FindSomeObjectThatIWant instead of
  35. Search(TestItem).  You would have only one instance of TestItem to worry about
  36. and your code would be more readable since you could name the method in a way
  37. that lends meaning (FindOldestObject, FindBiggestObject, etc.)."
  38.  
  39. That is exactly what I have done; the routine
  40. TMySortedList.FindSomeObjectThatIWant() is called TMySortedList.FindValue().
  41.  
  42. The purpose is not to add greater generality to TSortedList; it is quite
  43. general already.  However, the class does not make it easy to do a very common
  44. special case — that of finding the entry with a given key value.  To do this,
  45. one must use the general Search() method.  If the common special case were
  46. addressed by its own, very focused method — FindValue() — then the class would
  47. be easier to use in this common case, while still having the power and
  48. flexibility of the more general Search() routine where it was needed — and I
  49. think that you (and everyone else) would find the class to be both more useful
  50. and less confusing.
  51.  
  52. Hoping this helps,  I remain
  53.  
  54. Yours,
  55.  
  56. James Plamondon
  57.  
  58.